<?php
/**
 * welcome developer.
 * author: liangbo
 * company:tencent suzhou
 * contact:173120209
 * mobile:18550451730
 * Date: 2016-12-29
 * Time: 11:53
 */

class loginController extends Controller {

    public  function  index()
    {

        if($this->isAjax())
        {
            $this->api=true;
         $username=$this->post('username');
            $password=$this->post('password');
            if($username=='admin'&&$password=='123456')
            {

              $this->session()->set('myid','admin');
              echo json_encode(array('code'=>100,'message'=>'登陆成功','url'=>'/webmain'));



            }else{

                $this->session()->set('myid','');
                echo json_encode(array('code'=>200,'message'=>'登陆失败','url'=>'/login'));

            }

        }
        $this->assign('title','优住社区CRM');
    }
}